package com.john.seckill.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 公共返回对象
 * 日期 2021/5/19 14:55
 * 创建者：john
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultBean {
    private long code;
    private String message;
    private Object data;

    public static ResultBean success(){
        return new ResultBean(ResultBeanEnum.SUCCESS.getCode(), ResultBeanEnum.SUCCESS.getMessage(),null);
    }
    public static ResultBean success(Object data){
        return new ResultBean(ResultBeanEnum.SUCCESS.getCode(), ResultBeanEnum.SUCCESS.getMessage(),data);
    }
    public static ResultBean error(ResultBeanEnum resultBeanEnum){
        return new ResultBean(resultBeanEnum.getCode(), resultBeanEnum.getMessage(),null);
    }
    public static ResultBean error(ResultBeanEnum resultBeanEnum,Object data){
        return new ResultBean(resultBeanEnum.getCode(), resultBeanEnum.getMessage(),data);
    }
}
